home *** CD-ROM | disk | FTP | other *** search
/ Shareware Super Platinum 8 / Shareware Super Platinum 8.iso / mac / PROGTOOL / FLI106C.ZIP;1 / BLCHANGE.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-12  |  2.3 KB  |  129 lines

  1. //
  2. // The Fusion Library Interface for DOS
  3. // Version 1.06c
  4. // Copyright (C) 1990, 1991, 1992
  5. // Software Dimensions
  6. //
  7. // BlazeClass
  8. //
  9.  
  10. #ifndef __BCPLUSPLUS__
  11. #pragma inline
  12. #endif
  13.  
  14. #include "fli.h"
  15.  
  16. #ifdef __BCPLUSPLUS__
  17. #pragma hdrstop
  18. #endif
  19.  
  20. #define I asm
  21.  
  22. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  23. //
  24. // ChangeForeground()
  25. //
  26. // Changes the foreground (color) of a region of the screen
  27. //
  28. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  29.  
  30. void BlazeClass::ChangeForeground(int X,int Y,int Width,int Height,int Color)
  31. {
  32.   if (!Width || !Height || X>=WinWide || Y>=WinHigh)
  33.     return;
  34.  
  35.   int ScreenWidth = BlazeClass::QuickWidth;
  36.   int Locator = ((WinY+Y)*ScreenWidth)+((WinX+X)*2);
  37.  
  38.   if (X+Width>=WinWide)
  39.     Width=WinWide-X;
  40.  
  41.   if (Y+Height>=WinHigh)
  42.     Height=WinHigh-Y;
  43.  
  44.   void far *OUTPUT=BlazeClass::OUTPUT;
  45.   I les di,OUTPUT
  46.   I add di,Locator
  47.  
  48.   I mov bx,[Width]
  49.   I mov dx,[Height]
  50.  
  51.   I mov ah,byte ptr Color
  52.   I and ah,00000111b
  53.  
  54.   I cld
  55.  
  56. looped:
  57.  
  58.   I push di
  59.   I mov cx,bx
  60.  
  61. looper:
  62.  
  63.   I inc di
  64.   I mov al,byte ptr es:[di]
  65.   I and al,11111000b
  66.   I or al,ah
  67.   I stosb
  68.   I loop looper
  69.   I pop di
  70.   I add di,ScreenWidth
  71.   I dec dx
  72.   I or dx,dx
  73.   I jne looped
  74. }
  75.  
  76. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  77. //
  78. // ChangeBackground()
  79. //
  80. // Changes the background (color) of a region of the screen
  81. //
  82. //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  83.  
  84. void BlazeClass::ChangeBackground(int X,int Y,int Width,int Height,int Color)
  85. {
  86.   if (!Width || !Height || X>=WinWide || Y>=WinHigh)
  87.     return;
  88.  
  89.   int ScreenWidth = BlazeClass::QuickWidth;
  90.   int Locator = ((WinY+Y)*ScreenWidth)+((WinX+X)*2);
  91.  
  92.   if (X+Width>=WinWide)
  93.     Width=WinWide-X;
  94.  
  95.   if (Y+Height>=WinHigh)
  96.     Height=WinHigh-Y;
  97.  
  98.   void far *OUTPUT=BlazeClass::OUTPUT;
  99.   I les di,OUTPUT
  100.   I add di,Locator
  101.  
  102.   I mov bx,[Width]
  103.   I mov dx,[Height]
  104.  
  105.   I mov ah,byte ptr Color
  106.   I and ah,01110000b
  107.  
  108.   I cld
  109.  
  110. looped:
  111.  
  112.   I push di
  113.   I mov cx,bx
  114.  
  115. looper:
  116.  
  117.   I inc di
  118.   I mov al,byte ptr es:[di]
  119.   I and al,10001111b
  120.   I or al,ah
  121.   I stosb
  122.   I loop looper
  123.   I pop di
  124.   I add di,ScreenWidth
  125.   I dec dx
  126.   I or dx,dx
  127.   I jne looped
  128. }
  129.